﻿public class NetEvent_LikeComment : NetEvent
{
    public static NetEvent_LikeComment NewEvent()
    {
        return new NetEvent_LikeComment();
    }

    protected override ISerialize NewData() => new LikeCommentData();


    protected override void Excuate(ISerialize data)
    {
        LikeCommentData updateData = data as LikeCommentData;

        GameDebug.Log($"更新 LikeCommentData：{updateData?.likes?.GetListStr()} ");

        var moment = MGame.instance.MUser.moments.Find(e => e.momentId == updateData.momentId);
        if (moment != null)
        {
            var comment = moment.comments.Find(e => e.commentId == updateData.commentId);
            if (comment != null)
            {
                comment.likes = updateData.likes;
            }
            else
            {
                GameDebug.LogError($"cant find comment:{updateData.commentId}");
            }
        }
        else
        {
            GameDebug.LogError($"cant find moment:{updateData.momentId}");
        }
    }

}